package com.diandi.ddsb.bean;

/**
 * 发放方式类型
 *
 */

public enum GrantModeType {
	INSIDE_STATION_GRANT(1, "站内发放"), CLICK_RECEIVE(2, "点击领取"), ONLINE_GRANT(3, "线下发放"), OUTSIDE_STATION_GRANT(
			4, "站外发放");
	/**
	 * value
	 */
	private final String text;
	/**
	 * key
	 */
	private final int value;

	GrantModeType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public static GrantModeType getTextByValue(int value) {
		for (GrantModeType item : GrantModeType.values()) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new RuntimeException(value + "不是合法的类型！");
	}

	public static GrantModeType getValueByText(String text) {
		for (GrantModeType item : GrantModeType.values()) {
			if (item.getText().equals(text)) {
				return item;
			}
		}
		throw new RuntimeException(text + "不是合法的类型！");
	}

	public String getText() {
		return text;
	}

	public int getValue() {
		return value;
	}

}
